

<table cellpadding="0" cellspacing="0" border="0" width="170" style="padding-top: 20px;" align="center">
  <tr>
  	<td colspan=2 class='boxTitle'>Medlemmar</td>
  </tr>
<? if(isset($_SESSION['medlemId'])) { ?>
  <tr>
  	<td colspan=2 style='padding-top: 10px;'><a href='/minauppgifter.php'>Dina uppgifter</a></td>
  </tr>
  <tr>
  	<td colspan=2 style='padding-top: 10px;'><a href='/redirect.php?action=logout'>Logga ut</a></td>
  </tr>
  <tr>
  	<td colspan=2 style='padding-top: 10px;'>Du har 0 nya meddelanden</td>
  </tr>
<? } else { ?>
<form action="/redirect.php?action=login" method="post">
<input type='hidden' name='returnTo' value='<?= $_SERVER['REQUEST_URI']; ?>'>
  <tr>
  	<td colspan=2 style='padding: 10px 0;'><input type='text' value='E-mail' name='email' id='email' style='width: 170px; color: #999999;' onFocus="hints('email', 'E-mail')" onBlur="hints('email', 'E-mail')"></td>
  </tr>
  <tr>
  	<td colspan=2 style='padding-bottom: 10px;'><input type='password' value='password' name='password' id='password' style='width: 170px; color: #999999;' onFocus="hints('password', 'password')" onBlur="hints('password', 'password')"></td>
  </tr>
  <tr>
  	<td style='padding-bottom: 10px;'><input type='checkbox' name='remember' checked> Kom ihåg!</td>
  	<td align='right' style='padding-bottom: 10px;'><input type='submit' value='logga in'></td>
  </tr>
</form>
  <tr>
  	<td><b>Bli medlem</b></td>
  	<td align='right'><b>Förlorat lösen?</b></td>
  </tr>
<? } ?>
</table>

<table cellpadding="0" cellspacing="0" border="0" width="170" style="padding-top: 20px;" align="center">
  <tr>
	<td colspan=2 class='boxTitle'>Senast inloggade</td>
  </tr>
<?
$sSql = "SELECT * FROM tblMedlemmar ORDER BY inloggad DESC LIMIT 0, 5";
$result = mysql_query($sSql) or die(mysql_error());

while($row = mysql_fetch_array($result)) {
?>
  <tr>
	<td width=60 style='padding-top: 10px;'><a href='/medlem<?= $row['id'] ?>/<?= sToUrl($row['username']) ?>.php'><img src='/bilder/medlemmar/50x50/<?= strlen($row['avatar']) > 0 ? $row['avatar'] : "ingenbild.gif"; ?>' width=50 height=50 border=0></a></td>
	<td width=110 style='padding-top: 10px;'><a href='/medlem<?= $row['id'] ?>/<?= sToUrl($row['username']) ?>.php'><b><?= $row['username'] ?></b></a><br>
		<?= date("Y-m-d H:i", strtotime($row['inloggad'])); ?><br>
		<?= $row['inloggningar'] ?> inloggningar</td>
  </tr>
<? } ?>
</table>

<table cellpadding="0" cellspacing="0" border="0" width="170" style="padding-top: 20px;" align="center">
  <tr>
	<td colspan=2 class='boxTitle'>Senaste medlemmarna</td>
  </tr>
<?
$sSql = "SELECT * FROM tblMedlemmar ORDER BY id DESC LIMIT 0, 5";
$result = mysql_query($sSql) or die(mysql_error());

while($row = mysql_fetch_array($result)) {
?>
  <tr>
	<td width=60 style='padding-top: 10px;'><a href='/medlem<?= $row['id'] ?>/<?= sToUrl($row['username']) ?>.php'><img src='/bilder/medlemmar/50x50/<?= strlen($row['avatar']) > 0 ? $row['avatar'] : "ingenbild.gif"; ?>' width=50 height=50 border=0></a></td>
	<td width=110 style='padding-top: 10px;'><a href='/medlem<?= $row['id'] ?>/<?= sToUrl($row['username']) ?>.php'><b><?= $row['username'] ?></b></a><br>
		<?= date("Y-m-d H:i", strtotime($row['inloggad'])); ?><br>
		<?= $row['inloggningar'] ?> inloggningar</td>
  </tr>
<? } ?>
</table>